<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button type="button" onclick="testGet();">测试GET</button>
		<button type="button" onclick="testPost();">测试POST</button>
		<div id="content">
			
		</div>
	</body>
	<script type="text/javascript">
		function testGet(){
			var ajax = new XMLHttpRequest();
			ajax.open('GET','https://api.apiopen.top/api.html#4c502eec73ce429fb1c4a7f519360d24')
			
			// http://poetry.apiopen.top/poetryFull?count=2&page=1
			ajax.send()
			ajax.onreadystatechange = function(){
				if(ajax.readyState==4 && ajax.status==200){
					var obj = JSON.parse(ajax.responseText)
					if(obj.code == 200&&obj.message=="成功!"){
						document.getElementById('content').innerHTML = obj.result[0].content
						console.log(obj.result)
					}
				}
			}			
		}
	</script>
</html>
